Skip to content

Conversation

@aneillans
Copy link

@aneillans aneillans commented Nov 21, 2024

Issue describing the changes in this PR

Related to the issue linked below, adds the ability to pass a different access token to be used for the sync triggers call.

partially resolves #4196

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

@aneillans aneillans requested a review from a team as a code owner November 21, 2024 20:41
@aishwaryabh aishwaryabh changed the base branch from v4.x to main November 26, 2024 18:48
@liliankasem
Copy link
Member

@soninaren do you mind taking a look at this

@liliankasem liliankasem requested a review from Copilot March 13, 2025 20:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new command-line parameter (--sync-access-token) to allow the sync triggers call to use an access token that differs from the normal one. Key changes include updating the sync triggers logic in PublishFunctionAppAction.cs to use the new token if provided and adding the new SyncAccessToken property and parser setup in BaseAzureAction.cs.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs Updated the sync triggers method to assign SyncAccessToken from AccessToken if not provided and then use it in the sync call.
src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs Added a new SyncAccessToken property and command-line parameter for it.
Comments suppressed due to low confidence (2)

src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs:651

  • Consider adding unit tests for the sync triggers functionality to cover cases where 'SyncAccessToken' is provided and when it falls back to using 'AccessToken'.
if (string.IsNullOrEmpty(SyncAccessToken))

src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs:43

  • Consider adding unit tests to validate the new '--sync-access-token' command-line parameter, including its default handling when no sync token is explicitly provided.
Parser.Setup<string>("sync-access-token")

.Callback(t => AccessToken = t);
Parser
.Setup<string>("sync-access-token")
.WithDescription("Access token to use for performing trigger sync azure action (if different to normal)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove (if different to normal). This might cause some confusion for customers as what makes access token different.

HttpResponseMessage response = null;
// This SyncTriggers function calls the endpoint for linux syncTriggers
response = await AzureHelper.SyncTriggers(functionApp, AccessToken, ManagementURL);
if (string.IsNullOrEmpty(SyncAccessToken))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do the inverse instead and leave rest of the code as is.

if (!string.IsNullOrEmpty(SyncAccessToken))
{
    AccessToken = SyncAccessToken;
}

@liliankasem
Copy link
Member

Sorry it's taken so long to get to this.

The App Service Authentication layer shouldn't come into play here. The Core Tools calls ARM, which in turn calls an app admin endpoint which is not subject to user-defined auth checks.

@liliankasem liliankasem closed this Nov 3, 2025
@aneillans
Copy link
Author

Sorry it's taken so long to get to this.

The App Service Authentication layer shouldn't come into play here. The Core Tools calls ARM, which in turn calls an app admin endpoint which is not subject to user-defined auth checks.

If that's the case, then there are some issues with the kudu deployment process (would need to go back and check my notes on the issue I was hitting at the time).

Deployments behind fully authentication enabled do fail to correctly sync due to these calls not having the correct Auth passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inability to refresh triggers behind authenticated function app post deploy

3 participants